home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacOS 8 Resources / Developer Tools / Mac OS 8 Interfaces & Libraries / Interfaces / IDLIncludes / ConditionalMacros.idl < prev    next >
Text File  |  1996-05-01  |  13KB  |  315 lines

  1. /*
  2.      File:        ConditionalMacros.idl
  3.  
  4.      Contains:    Set up for compiler independent conditionals
  5.  
  6.      Version:    Technology:    Universal Interface Files 3.0dx
  7.                  Release:    Universal Interfaces 3.0d3 on Copland DR1
  8.  
  9.      Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10.  
  11.      Bugs?:        If you find a problem with this file, send the file and version
  12.                  information (from above) and the problem description to:
  13.  
  14.                      Internet:    apple.bugs@applelink.apple.com
  15.                      AppleLink:    APPLE.BUGS
  16.  
  17. */
  18. #ifndef __CONDITIONALMACROS_IDL__
  19. #define __CONDITIONALMACROS_IDL__
  20.  
  21. #include <somobj.idl>
  22. #include <somcls.idl>
  23.  
  24. /*
  25. ***************************************************************************************************
  26.     UNIVERSAL_INTERFACES_VERSION
  27.     
  28.         0x0300 => version 3.0
  29.         0x0210 => version 2.1
  30.         This conditional did not exist prior to version 2.1
  31. ***************************************************************************************************
  32. */
  33. /*
  34. ***************************************************************************************************
  35.     GENERATINGPOWERPC        - Compiler is generating PowerPC instructions
  36.     GENERATING68K            - Compiler is generating 68k family instructions
  37.  
  38.         Invariant:
  39.             GENERATINGPOWERPC != GENERATING68K
  40. ***************************************************************************************************
  41. */
  42. #ifdef GENERATINGPOWERPC
  43. #ifndef GENERATING68K
  44. #define GENERATING68K !GENERATINGPOWERPC
  45. #endif
  46. #endif
  47. #ifdef GENERATING68K
  48. #ifndef GENERATINGPOWERPC
  49. #define GENERATINGPOWERPC !GENERATING68K
  50. #endif
  51. #endif
  52. #ifndef GENERATINGPOWERPC
  53. #if defined(powerc) || defined(__powerc)
  54. #define GENERATINGPOWERPC 1
  55. #else
  56. #define GENERATINGPOWERPC 0
  57. #endif
  58. #endif
  59. #ifndef GENERATING68K
  60. #if GENERATINGPOWERPC
  61. #define GENERATING68K 0
  62. #else
  63. #define GENERATING68K 1
  64. #endif
  65. #endif
  66. /*
  67. ***************************************************************************************************
  68.     GENERATING68881            - Compiler is generating mc68881 floating point instructions
  69.     
  70.         Invariant:
  71.             GENERATING68881 => GENERATING68K
  72. ***************************************************************************************************
  73. */
  74. #if GENERATING68K
  75. #if defined(applec) || defined(__SC__)
  76. #ifdef mc68881
  77. #define GENERATING68881 1
  78. #endif
  79. #else
  80. #ifdef __MWERKS__
  81. #if __MC68881__
  82. #define GENERATING68881 1
  83. #endif
  84. #endif
  85. #endif
  86. #endif
  87. #ifndef GENERATING68881
  88. #define GENERATING68881 0
  89. #endif
  90. /*
  91. ***************************************************************************************************
  92.     GENERATINGCFM            - Code being generated assumes CFM calling conventions
  93.     CFMSYSTEMCALLS            - No A-traps.  Systems calls are made using CFM and UPP's
  94.  
  95.         Invariants:
  96.             GENERATINGPOWERPC => GENERATINGCFM
  97.             GENERATINGPOWERPC => CFMSYSTEMCALLS
  98.             CFMSYSTEMCALLS => GENERATINGCFM
  99. ***************************************************************************************************
  100. */
  101. #if GENERATINGPOWERPC || defined(__CFM68K__)
  102. #define GENERATINGCFM 1
  103. #define CFMSYSTEMCALLS 1
  104. #else
  105. #define GENERATINGCFM 0
  106. #define CFMSYSTEMCALLS 0
  107. #endif
  108. /*
  109. ***************************************************************************************************
  110.     One or none of the following BUILDING_~= conditionals is expected to be set during 
  111.     compilation (e.g. MrC -d BUILDING_FOR_SYSTEM7), the others should be left undefined.
  112.     If none is set, BUILDING_FOR_SYSTEM7_AND_SYSTEM8 is used.
  113.     
  114.         BUILDING_FOR_SYSTEM7                - Code is intended to run on System 7.x machine or earlier .
  115.         BUILDING_FOR_SYSTEM7_AND_SYSTEM8    - Code is intended to run on System 7 or Copland.
  116.         BUILDING_FOR_SYSTEM8                - Code is intended to run on Copland only.
  117.         BUILDING_PREEMPTIVE_CODE            - Code is intended to run as Copland server or driver.
  118.         
  119.     The following conditionals are set up based on which of the BUILDING_~= flag (above) was specified.
  120.     They are used in throughout the interface files to conditionalize declarations.
  121.     
  122.         FOR_SYSTEM7_ONLY                    - In System 7. Not in Copland.
  123.         FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED    - In System 7. Works in Copland, but there is a better way.
  124.         FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE    - In System 7. In Copland, but only for cooperative tasks.
  125.         FOR_SYSTEM7_AND_SYSTEM8_PREEMPTIVE    - In System 7. In Copland.
  126.         FOR_SYSTEM8_COOPERATIVE                - Not in System 7.  In Copland, but only for cooperative tasks.
  127.         FOR_SYSTEM8_PREEMPTIVE                - Not in System 7.  In Copland.
  128.         
  129.         FOR_OPAQUE_SYSTEM_DATA_STRUCTURES    - Always true for system 8, but can be set by developer to
  130.                                               true or false for System 7.  When true, the contents of 
  131.                                               many system data structures are removed from the interfaces.
  132.                                               In the future, the Mac OS will have fewer data structures 
  133.                                               shared between applications and the system.  The problem
  134.                                               with shared data is 1) the system has to poll the data
  135.                                               to detect changes made by an application, 2) it prevents
  136.                                               data structures from being changed in the future.
  137.                                               Procedural interface will be used instead.
  138.                                               
  139.         FOR_PTR_BASED_AE                    - This is a temporary fix for Copland DR1.  It is needed to
  140.                                               distinguish between pointer based and handle based AppleEvents.
  141.                                               If you are in the case of BUILDING_FOR_SYSTEM7_AND_SYSTEM8
  142.                                               and want to use new pointer base AppleEvents, you will need to
  143.                                               -d FOR_PTR_BASED_AE on your compiler command line.
  144.         
  145. ***************************************************************************************************
  146. */
  147. #if 0
  148. /* extra if statement is to work around a bug in PPCAsm 1.2a2 */
  149. #elif defined(BUILDING_FOR_SYSTEM7)
  150. #ifndef FOR_OPAQUE_SYSTEM_DATA_STRUCTURES
  151. #define FOR_OPAQUE_SYSTEM_DATA_STRUCTURES 0
  152. #endif
  153. #define FOR_PTR_BASED_AE 0
  154. #define FOR_SYSTEM7_ONLY 1
  155. #define FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED 1
  156. #define FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE 1
  157. #define FOR_SYSTEM7_AND_SYSTEM8_PREEMPTIVE 1
  158. #define FOR_SYSTEM8_COOPERATIVE 0
  159. #define FOR_SYSTEM8_PREEMPTIVE 0
  160. #elif defined(BUILDING_FOR_SYSTEM7_AND_SYSTEM8)
  161. #ifndef FOR_OPAQUE_SYSTEM_DATA_STRUCTURES
  162. #define FOR_OPAQUE_SYSTEM_DATA_STRUCTURES 1
  163. #endif
  164. #ifndef FOR_PTR_BASED_AE
  165. #define FOR_PTR_BASED_AE 0
  166. #endif
  167. #define FOR_SYSTEM7_ONLY 0
  168. #define FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED 1
  169. #define FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE 1
  170. #define FOR_SYSTEM7_AND_SYSTEM8_PREEMPTIVE 1
  171. #define FOR_SYSTEM8_COOPERATIVE 1
  172. #define FOR_SYSTEM8_PREEMPTIVE 1
  173. #elif defined(BUILDING_FOR_SYSTEM7_AND_SYSTEM)
  174. /* xlc has a limit of 31 chars for command line defines, so redefine above clipped to 31 chars */
  175. #ifndef FOR_OPAQUE_SYSTEM_DATA_STRUCTURES
  176. #define FOR_OPAQUE_SYSTEM_DATA_STRUCTURES 1
  177. #endif
  178. #ifndef FOR_PTR_BASED_AE
  179. #define FOR_PTR_BASED_AE 0
  180. #endif
  181. #define FOR_SYSTEM7_ONLY 0
  182. #define FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED 1
  183. #define FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE 1
  184. #define FOR_SYSTEM7_AND_SYSTEM8_PREEMPTIVE 1
  185. #define FOR_SYSTEM8_COOPERATIVE 1
  186. #define FOR_SYSTEM8_PREEMPTIVE 1
  187. #elif defined(BUILDING_FOR_SYSTEM8)
  188. #define FOR_OPAQUE_SYSTEM_DATA_STRUCTURES 1
  189. #define FOR_PTR_BASED_AE 1
  190. #define FOR_SYSTEM7_ONLY 0
  191. #define FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED 0
  192. #define FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE 1
  193. #define FOR_SYSTEM7_AND_SYSTEM8_PREEMPTIVE 1
  194. #define FOR_SYSTEM8_COOPERATIVE 1
  195. #define FOR_SYSTEM8_PREEMPTIVE 1
  196. #elif defined(BUILDING_PREEMPTIVE_CODE)
  197. #define FOR_OPAQUE_SYSTEM_DATA_STRUCTURES 1
  198. #define FOR_PTR_BASED_AE 1
  199. #define FOR_SYSTEM7_ONLY 0
  200. #define FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED 0
  201. #define FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE 0
  202. #define FOR_SYSTEM7_AND_SYSTEM8_PREEMPTIVE 1
  203. #define FOR_SYSTEM8_COOPERATIVE 0
  204. #define FOR_SYSTEM8_PREEMPTIVE 1
  205. #else
  206. /* default is BUILDING_FOR_SYSTEM7_AND_SYSTEM8  */
  207. #define FOR_OPAQUE_SYSTEM_DATA_STRUCTURES 1
  208. #ifndef FOR_PTR_BASED_AE
  209. #define FOR_PTR_BASED_AE 0
  210. #endif
  211. #define FOR_SYSTEM7_ONLY 0
  212. #define FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED 1
  213. #define FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE 1
  214. #define FOR_SYSTEM7_AND_SYSTEM8_PREEMPTIVE 1
  215. #define FOR_SYSTEM8_COOPERATIVE 1
  216. #define FOR_SYSTEM8_PREEMPTIVE 1
  217. #endif
  218. /*
  219. ***************************************************************************************************
  220.  
  221.     OLDROUTINENAMES            - "Old" names for Macintosh system calls are allowed in source code.
  222.                               (e.g. DisposPtr instead of DisposePtr). The names of system routine
  223.                               are now more sensitive to change because CFM binds by name.  In the 
  224.                               past, system routine names were compiled out to just an A-Trap.  
  225.                               Macros have been added that each map an old name to its new name.  
  226.                               This allows old routine names to be used in existing source files,
  227.                               but the macros only work if OLDROUTINENAMES is true.  This support
  228.                               will be removed in the near future.  Thus, all source code should 
  229.                               be changed to use the new names! You can set OLDROUTINENAMES to false
  230.                               to see if your code has any old names left in it.
  231.     
  232.     OLDROUTINELOCATIONS     - "Old" location of Macintosh system calls are used.  For example, c2pstr 
  233.                               has been moved from Strings to TextUtils.  It is conditionalized in
  234.                               Strings with OLDROUTINELOCATIONS and in TextUtils with !OLDROUTINELOCATIONS.
  235.                               This allows developers to upgrade to newer interface files without suddenly
  236.                               all their code not compiling becuase of "incorrect" includes.  But, it
  237.                               allows the slow migration of system calls to more understandable file
  238.                               locations.  OLDROUTINELOCATIONS currently defaults to true, but eventually
  239.                               will default to false.
  240.  
  241. ***************************************************************************************************
  242. */
  243. #ifndef OLDROUTINENAMES
  244. #define OLDROUTINENAMES 0
  245. #endif
  246. #ifndef OLDROUTINELOCATIONS
  247. #define OLDROUTINELOCATIONS 0
  248. #endif
  249. /*
  250. ***************************************************************************************************
  251.     C specific conditionals
  252.  
  253.     CGLUESUPPORTED            - Interface library will support "C glue" functions (function names
  254.                               are: all lowercase, use C strings instead of pascal strings, use 
  255.                               Point* instead of Point).
  256.  
  257.     PRAGMA_ALIGN_SUPPORTED    - Compiler supports "#pragma align=..." directives. The only compilers that
  258.                               can get by without supporting the pragma are old classic 68K compilers
  259.                               that will only be used to compile older structs that have 68K alignment
  260.                               anyways.  
  261.     
  262.     PRAGMA_IMPORT_SUPPORTED    - Compiler supports "#pragma import on/off" directives.  These directives
  263.                               were introduced with the SC compiler which supports CFM 68K.  The directive
  264.                               is used to tell the compiler which functions will be called through a 
  265.                               transition vector (instead of a simple PC-relative offset).  This allows 
  266.                               the compiler to generate better code.  Since System Software functions are
  267.                               implemented as shared libraries and called through transition vectors,
  268.                               all System Software functions are declared with "#pragma import on".
  269.                               
  270.         Invariants:
  271.             PRAGMA_IMPORT_SUPPORTED => CFMSYSTEMCALLS
  272.             GENERATINGPOWERPC => PRAGMA_ALIGN_SUPPORTED
  273. ***************************************************************************************************
  274. */
  275. #ifndef CGLUESUPPORTED
  276. #ifdef THINK_C
  277. #define CGLUESUPPORTED 0
  278. #else
  279. #define CGLUESUPPORTED 1
  280. #endif
  281. #endif
  282. /*
  283.     All PowerPC compilers support pragma align
  284.     For 68K, only Metrowerks and SC 8.0 support pragma align 
  285. */
  286. /* Currently, only Metowerks CW7 and later, and SC 8.0 or later support pragma import  */
  287. /*
  288. ***************************************************************************************************
  289.     Set up old "USES..." conditionals to support 1.0 universal interface files
  290.  
  291.     The USESxxx names are old, but cannot be removed yet because source code that
  292.     uses them might still compile, but do the wrong thing. 
  293. ***************************************************************************************************
  294. */
  295. #ifndef USES68KINLINES
  296. #define USES68KINLINES GENERATING68K
  297. #endif
  298. #define USESCODEFRAGMENTS GENERATINGCFM
  299. #define USESROUTINEDESCRIPTORS GENERATINGCFM
  300. /*
  301. ***************************************************************************************************
  302.     The following macros isolate the use of inlines from the routine prototypes.
  303.     A routine prototype will always be followed by on of these inline macros with
  304.     a list of the opcodes to be inlined.  On the 68K side, the appropriate inline
  305.     code will be generated.  On platforms that use code fragments, the macros are
  306.     essentially NOPs.
  307. ***************************************************************************************************
  308. */
  309. #if CFMSYSTEMCALLS
  310. #else
  311. #endif
  312.  
  313. #endif /* __CONDITIONALMACROS_IDL__ */
  314.  
  315.